package org.pictual.controller.mainPackage;

import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map.Entry;

public class CategoriesWrapper {

    Hashtable<String,DefinitionList> _categories;

    public CategoriesWrapper() {
        _categories = new Hashtable<String,DefinitionList>();
    }

    public DefinitionList getDefinitionList(String name)
    {
        if (  (!_categories.isEmpty()) &&  (_categories.containsKey(name))){
            return _categories.get(name); //Get a DefList by its name
        }else{
        	//Create a new DefList only with the name of the def as key
            DefinitionList list = new DefinitionList();
            _categories.put(name, list);
            return list;
        }
    }

    public void putDefinitionList(String name)
    {
    	DefinitionList dl=new DefinitionList();
    	dl.addExample("ex");
    	dl.addDefinition("def");
        _categories.put(name, dl);
    }


    public Iterator<Entry<String,DefinitionList>> getIterator()
    {
        return _categories.entrySet().iterator();
    }

    public boolean isEmpty()
    {
        return _categories.isEmpty();
    }


}
